package com.study.blog.controller;

import com.study.blog.common.result.BaseResponse;
import com.study.blog.model.dto.EmailSendDTO;
import com.study.blog.service.impl.EmailServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "邮件服务")
@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private EmailServiceImpl emailService;

    @ApiOperation(value = "邮件发送")
    @PostMapping("/send")
    public BaseResponse<String> activationAccount(@RequestBody @Validated EmailSendDTO email) {
        emailService.sendHtmlMail(email.getEmail(), email.getSubject(), email.getContent());
        return BaseResponse.success("发送成功");
    }


}
